﻿using System.Windows.Controls;

namespace UI.Dialogs.Dictionaries
{
    /// <summary>
    /// Abstract class for dictionary builders
    /// </summary>
    public abstract class DictionaryBuilder
    {
        /// <summary>
        /// Gets or sets the dictionary form.
        /// </summary>
        /// <value>The dictionary form.</value>
        public DictionaryFormBase Form { get; internal set;}

        /// <summary>
        /// Initializes a new instance of the <see cref="DictionaryBuilder"/> class.
        /// </summary>
        /// <param name="form">The dictionary form.</param>
        public DictionaryBuilder(DictionaryFormBase form)
        {
            Form = form;
        }

        /// <summary>
        /// Builds the dictionary form and functionality.
        /// </summary>
        public abstract void Build();
        /// <summary>
        /// Updates the selected item.
        /// </summary>
        public abstract void Update();
        /// <summary>
        /// Saves the new item.
        /// </summary>
        public abstract void Save();
        /// <summary>
        /// Sets the selected item.
        /// </summary>
        /// <param name="item">The item.</param>
        public abstract void SetSelected(object item);
        /// <summary>
        /// Updates the grid.
        /// </summary>
        /// <param name="operation">The operation.</param>
        /// <param name="item">The item.</param>
        public abstract void UpdateGrid(UpdateOperation operation, object item);

        /// <summary>
        /// Selection changed event handler.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="System.Windows.Controls.SelectionChangedEventArgs"/> instance containing the event data.</param>
        protected virtual void SelectionChanged(object sender, SelectionChangedEventArgs args)
        {
            Form.EditTab.IsEnabled = true;
        }

    }

    
}
